/**
 * Created with WebStorm.
 * User: Administrator
 * Date: 2018/4/12
 * Time: 16:03
 * To change this template use File | Settings | File Templates.
 */
$(document).ready(function () {
  var officeListData = {};
  var officeListHtml ='';
    $.ajax({
            type:'POST',
            url:'http://10.128.203.15:8080/find/cat/name.do',
            data:{catName:'办公场所'},
            dataType:'jsonp',
            jsonp:'jsoncallback',
            success:function(data){
              officeListData = data;
              console.log(officeListData);
              console.log(officeListData[1].cat_id);
              for(i=0;i<officeListData.length;i++){
                officeListHtml += '<a href="javascript:;" class="maintain-tab-item office-jumpTo" data-id="'+officeListData[i].cat_id+'">'+officeListData[i].name+'</a>';
              }
              $('.content_list-office').html(officeListHtml);
            },
            error:function () {//请求失败后调用的函数
              alert("error");
            },
            failure: function() {
              alert('fail');
            }
    });

  //获取城市ajax
  $.ajax({
    url: 'http://api.map.baidu.com/location/ip?ak=ia6HfFL660Bvh43exmH9LrI6',
    type: 'POST',
    dataType: 'jsonp',
    success:function(data) {
      console.log(JSON.stringify(data.content.address_detail.province + "," + data.content.address_detail.city));
    }
  });
});
